package com.socket;

import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;

import static com.socket.MyServer.MY_SERVER_PORT;

public class MyClient {
    public static void main(String[] args) {
        commonWithServer();
    }
    private static void commonWithServer() {
        try (
                Socket s = new Socket("localhost", MY_SERVER_PORT);
        ) {
            Chat chat = new Chat("服务端", null, s);
            chat.chatting();
        } catch (UnknownHostException ex) {
            ex.printStackTrace();
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }
}
